/*
 * @Description:
 * @Author: IA ia@kepro.space
 * @Date: 2025-02-21 17:53:43
 */
/**
 * @Description:
 * @Author: IA ia@kepro.space
 * @Date: 2025-02-10 09:55:16
 */
// import './assets/main.css'

import { createApp } from 'vue'
import { createPinia } from 'pinia'

import ElementPlus, { type Filter } from 'element-plus'
import 'element-plus/dist/index.css'

import * as ElementPlusIconsVue from '@element-plus/icons-vue'


import CardVue from '@/components/15th/Card.vue'

import useResize from 'v-resize-ia-28th'

import App from './App.vue'
import router from './router'

import 'uno.css'

import mitt from 'mitt'

const Mitt = mitt()

export const app = createApp(App)
app.use(ElementPlus)
for (const [key, component] of Object.entries(ElementPlusIconsVue)) {
  app.component(key, component)
}

// 第二十九章
// 通过 app.config.globalProperties.$ 定义全局变量
app.config.globalProperties.$env = 'dev'
app.config.globalProperties.$filters = {
  format<T>(str: T) {
    return `IA in main.ts and str=${str}`
  }
}

type Filter = {
  format<T>(str: T): string
}

// 全局变量声明文件
declare module 'vue' {
  export interface ComponentCustomProperties {
    $env: string,
    $filters: Filter
  }
}

import iLoading from '@/components/30th/iLoading/index.ts'
// app.use(iLoading)
import { myUse } from './views/30th/myUse'
myUse(iLoading)

type Lod = {
  show: () => void,
  hide: () => void
}
//编写ts loading 声明文件放置报错 和 智能提示
declare module 'vue' {
  export interface ComponentCustomProperties {
    $iLoading: Lod
  }
}

import './tailwindcss.css'

app.use(createPinia())
app.use(router)
app.use(useResize)
app.component('CardVue2', CardVue)

declare module 'vue' {
  export interface ComponentCustomProperties {
    $Bus: typeof Mitt
  }
}

app.config.globalProperties.$Bus = Mitt

app.mount('#app')
